//
//  KYSettingSwitchItem.m
//  KYKJPackDemo
//
//  Created by Jordan zhou on 2017/9/21.
//  Copyright © 2017年 ???. All rights reserved.
//

#import "KYSettingSwitchItem.h"

@implementation KYSettingSwitchItem
- (instancetype)init
{
    if (self = [super init]) {
        self.defaultOn = YES;
    }
    return self;
}

- (BOOL)isOn
{
    id value = [KYUserDefaults objectForKey:self.key];
    
    if (value == nil) {
        return self.isDefaultOn;
    } else {
        return [value boolValue];
    }
}

- (void)setOn:(BOOL)on
{
    [KYUserDefaults setBool:on forKey:self.key];
    [KYUserDefaults synchronize];
}
@end
